package edu.neu.cs6515.xml;

import java.util.LinkedList;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * Bean to represent to info of a XML Input board. Example:
 * {@code
 * <board players=PlayerNumber> 
     <placement c0=Color d0=Nat a0=Nat c1=Color d1=Nat a1=Nat /> 
     <placement c0=Color d0=Nat a0=Nat c1=Color d1=Nat a1=Nat /> 
     <placement c0=Color d0=Nat a0=Nat c1=Color d1=Nat a1=Nat /> 
     ...
  </board> 
 * } 
 *
 */
@XmlRootElement
@NoArgsConstructor 
@EqualsAndHashCode
public final class Board {

    @Getter @Setter
    private List<Placement> placement = new LinkedList<Placement>();

    private int players;
  
    /**
     * Initialize Board with list of placements and number of players (used by JAXB!)  
     * @param placement list of alternating placments, strictly in order, deping on number of players
     * @param players number of players between 2 and 6
     */
    public Board(final List<Placement> placement, final int players) {
        this.placement = placement;
        this.players = players;
    }
    
    @XmlAttribute
    public int getPlayers() {
        return players;
    }


    public void setPlayers(final int players) {
        this.players = players;
    }
    
}
